package cn.yeziji.forum.controller;

import cn.yeziji.forum.common.ForumResult;
import cn.yeziji.forum.service.MarkdownService;
import cn.yeziji.forum.utils.ForumResultUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * 论坛 markdown 控制器
 *
 * @author gzkemays
 * @since 2022/2/22 13:41
 */
@RestController
@RequestMapping("/markdown")
public class ForumMarkdownController {
  @Resource MarkdownService markdownService;

  @PostMapping("/read")
  public ForumResult read(MultipartFile file) {
    return ForumResultUtils.ok(markdownService.read(file));
  }
}
